package io.github.talelin.latticy.model;

import java.math.BigDecimal;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.talelin.latticy.common.enumeration.DistanceUnitEnum;
import io.github.talelin.latticy.common.enumeration.InboundOrderBoxModelEnum;
import io.github.talelin.latticy.common.enumeration.MassUnitEnum;
import io.github.talelin.latticy.dto.receving.ReceivingPackageDTO;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

/**
 * 入库收货记录表
 *
 * @author generator@wulongbo
 * @since 2022-07-20
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@NoArgsConstructor
@TableName("t_receiving_record")
public class ReceivingRecordDO extends BaseModel {

    /**
     * 所属仓库code
     */
    private String warehouseCode;

    /**
     * 入库单编号
     */
    private String inboundOrderNo;

    /**
     * 箱号
     */
    private String packageNo;

    /**
     * 箱子型号(1.大 2.中 3.小 4.特大)
     */
    private InboundOrderBoxModelEnum boxModel;

    /**
     * 尺寸单位类型(1.cm 2.in)
     */
    private DistanceUnitEnum distanceUnit;

    /**
     * 重量单位类型(1.kg 2.lb/oz)
     */
    private MassUnitEnum massUnit;

    /**
     * 产品重量
     */
    private BigDecimal weight;


    /**
     * 产品长
     */
    private BigDecimal length;

    /**
     * 产品宽
     */
    private BigDecimal width;

    /**
     * 产品高
     */
    private BigDecimal height;

    /**
     * 本次接收件数
     */
    private Integer receiveNum;

    /**
     * 标品数
     */
    private Integer specimen;

    /**
     * 破损数
     */
    private Integer damaged;

    /**
     * 是否虚拟箱
     */
    private Boolean isFictitious;

    /**
     * 揽收时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime receivedTime;

    /**
     * 经办人
     */
    private String receivedBy;

    public ReceivingRecordDO(ReceivingPackageDTO dto, String warehouseCode, String inboundOrderNo, String receivedBy) {
        BeanUtils.copyProperties(dto, this);
        this.warehouseCode = warehouseCode;
        this.inboundOrderNo = inboundOrderNo;
        this.receivedBy = receivedBy;
    }

}
